$(document).ready(function() {
	
	$("#add-new").click(function(){
		$("#form-content").load('/clientes/form');
		removeSelectedRow(oTable);
	});

	$("tbody").live('click', function(event) {
		$(oTable.fnSettings().aoData).each(function() {
			$(this.nTr).removeClass('row-selected');
		});
		$(event.target.parentNode).addClass('row-selected');
	});

	$('#clientes-table tbody tr').live('click', function() {

		var aData = oTable.fnGetData(this);

		$.get("/clientes/show", {
			id : aData[0]
		}, function(data) {
				$("#form-content").html(data);
		});

	});
	
	oTable = initHiddenColumnDataTable($("#clientes-table"));

});